const CracoLessPlugin = require('craco-less');
//配置webpack
module.exports = {
    plugins: [
        {
            plugin: CracoLessPlugin,
            options: {
                lessLoaderOptions: {
                    lessOptions: {
                        modifyVars: { '@primary-color': '#95de64' },
                        javascriptEnabled: true,
                        test: /\.(css|less)$/,
                        // test: /\.module\.less$/,
                        // 配置打包为相对路径
                        // assetsPublicPath: '/',
                        entry: '/src/index.js',
                        use: [
                            'style-loader',
                            {
                                loader: 'css-loader',
                                options: {
                                    modules: true
                                }
                            },
                            "less-loader"
                        ],//从右往左执行
                        resolve: {
                            extensions: ['.js', '.jsx'], //后缀名自动补全
                        }
                    },

                }
            }
        }
    ]
}